#ifndef PICTUREWIDGET_H
#define PICTUREWIDGET_H

#include <QWidget>
#include <QButtonGroup>
#include <QGraphicsScene>

#define RAW_VIEW_SIZE QSize(750,198) //场景大小
#define SCALE_VIEW_PIXMAP (qreal)1/1 //场景与图片比例
#define SCALE_BIG_SMALL (qreal)1/1 //图片大小比例
#define FPS 60
#define DURATION_MS 500
#define SWITCHING_INTERVAL 5000

namespace Ui {
class pictureWidget;
}

class pictureWidget : public QWidget
{
    Q_OBJECT

public:
    enum Rules:int{
        RuleA = 1,
        RuleB = -1,
        RuleC = 2,
        RuleD = -2
    };
    explicit pictureWidget(QWidget *parent = nullptr, QList<QPixmap> *PixmapList = nullptr);
    ~pictureWidget();
    void setButtonGroup();
    void setInitList();
    void setPictureScreen();
    void setTimerAndConnect();
    int getrightN(int num);
    void rollItem(int rollDir, unsigned rollCount); //找最新id位置

public slots:
    void timerOutFunc(); //超时操作
    void clickedItemRoll(int type);
private slots:
    void btnL_clicked();
    void btnR_clicked();

private:
    Ui::pictureWidget *ui;

    QTimer *m_timer;//定时器
    QTimer *m_newT;//旋转定时器
    QGraphicsScene *m_scene;//场景
    int m_index;
    Rules m_currentRule;//当前操作类型
    unsigned m_rollCount;//滚动次数
    QButtonGroup *m_BtnGroup;
    bool btnMoveEnable;

    QLineF m_MidLine;//中间线

    QList<qreal> m_PointList;//图片位置信息
    QList<qreal> m_ZValueList;//图片优先级
    QList<qreal> m_PixmapScaleList;//图片位置伸缩因子

    QList<QPixmap> m_PixmapList;//图片列表
};

#endif // PICTUREWIDGET_H
